# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test08
# Description:
# Author:       ASUS
# Date:         2019/5/25
#-------------------------------------------------------------------------------


import threading
from time import sleep,ctime

class Mythread(threading.Thread):
    def __init__(self,func,args,name=''):
        super().__init__(target=func,name=name,args=args)

    def run(self):
        self._target(*self._args)

def func(index,sec):
    print('开始执行',index,'执行时间',ctime())
    sleep(sec)
    print('执行结束', index, '结束时间', ctime())

def main():
    thread1 = Mythread(func,args=(40,4),name='thread1')
    thread1.start()
    thread2 = Mythread(func,args=(20,2),name='thread2')
    thread2.start()
    thread1.join()
    thread2.join()


if __name__ == '__main__':
    main()




